package com.molichuxing.services.infrastructure.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.molichuxing.services.infrastructure.convertor.Convert;
import com.molichuxing.services.infrastructure.dao.FileStorageConfigMapper;
import com.molichuxing.services.infrastructure.dto.response.FileStorageConfigDto;
import com.molichuxing.services.infrastructure.service.FileStorageConfigService;

/**
 * 文件存储配置service
 * 
 * @author zoumingyu
 * @date 2019年9月5日
 *
 */
@Service("fileStorageConfigService")
public class FileStorageConfigServiceImpl implements FileStorageConfigService {

	@Resource
	private FileStorageConfigMapper fileStorageConfigMapper;

	/**
	 * 获取所有
	 * 
	 * @return
	 */
	@Override
	public List<FileStorageConfigDto> getAll() {
		return Convert.toFileStorageConfigDto(fileStorageConfigMapper.getAll());
	}

	/**
	 * 根据类型（归属文件夹）查询
	 * 
	 * @param folder
	 * @return
	 */
	@Override
	public FileStorageConfigDto getFileStorageConfig(String folder) {
		return Convert
				.toFileStorageConfigDto(
						folder == null ? null : fileStorageConfigMapper.getFileStorageConfigByFolder(folder));
	}
}
